﻿
using System;
using System.Collections.Generic;
using Csla;
using Ent.AccesoDatos;

namespace Ent.Inscripcion.Core
{
    [Serializable]
    public class InfoServicios : 
      BusinessListBase<InfoServicios, InfoServicio>
    {
        #region Factory Methods

        public static InfoServicios NewInfoServicios()
        {
            return DataPortal.CreateChild<InfoServicios>();
        }

        internal static InfoServicios GetInfoServicios(
          object childData)
        {
            return DataPortal.FetchChild<InfoServicios>(childData);
        }

        private InfoServicios()
        { }

        #endregion

        #region Data Access

        private void Child_Fetch(Guid childData)
        {
            RaiseListChangedEvents = false;
            
            RaiseListChangedEvents = true;
        }

        #endregion
    }


    [Serializable]
    public class InfoServicio : BusinessBase<InfoServicio>
    {
        #region Business Methods

        public static readonly PropertyInfo<string> CodigoProperty = RegisterProperty<string>(c => c.Codigo);
        /// <Summary>
        /// Gets or sets the codigo value.
        /// </Summary>
        public string Codigo
        {
            get { return GetProperty(CodigoProperty); }
            set { SetProperty(CodigoProperty, value); }
        }

        public static readonly PropertyInfo<string> NombreProperty = RegisterProperty<string>(c => c.Nombre);
        /// <Summary>
        /// Gets or sets the nombre value.
        /// </Summary>
        public string Nombre
        {
            get { return GetProperty(NombreProperty); }
            set { SetProperty(NombreProperty, value); }
        }

        public static readonly PropertyInfo<string> DescripcionProperty = RegisterProperty<string>(c => c.Descripcion);
        /// <Summary>
        /// Gets or sets the Descripcion value.
        /// </Summary>
        public string Descripcion
        {
            get { return GetProperty(DescripcionProperty); }
            set { SetProperty(DescripcionProperty, value); }
        }

        #endregion

        #region Validation Rules

        protected override void AddBusinessRules()
        {
            // TODO: add validation rules
            //ValidationRules.AddRule(RuleMethod, "");
        }

        #endregion      

        #region Factory Methods

        public static InfoServicio NewInfoServicio()
        {
            var item=DataPortal.CreateChild<InfoServicio>();
            
            return item;
        }

        internal static InfoServicio GetInfoServicio(object childData)
        {
            return DataPortal.FetchChild<InfoServicio>(childData);
        }

        public InfoServicio()
        {
            
        }

        #endregion

        #region Data Access

        protected override void Child_Create()
        {
            // TODO: load default values
            // omit this override if you have no defaults to set
            base.Child_Create();
        }

        private void Child_Fetch(Reader childData)
        {
            
        }

        private void Child_Insert(Guid parentId)
        {
            
        }

        private void Child_Update(Guid parent)
        {
            
        }

        private void Child_DeleteSelf(Guid parent)
        {
            
        }

        #endregion
    }
}
